
Public Sub test_all_case()
    Test_numStr
    Test_numStrNotStartByZero
    Test_numInRange
    Test_lowerEnStr
    Test_upperEnStr
    Test_enStr
    Test_yyyyMMddInYearRange
    timestampTest
End Sub


Private Sub Test_numStr()
    Dim result As String
    result = UtilsRandom.numStr(10)
    Debug.Assert Len(result) = 10
    
    Dim i As Integer
    Dim ascCode As Integer
    For i = 1 To 10
        ascCode = Asc(Mid(result, i, 1))
        Debug.Assert ascCode >= 48
        Debug.Assert ascCode <= 57
    Next
End Sub

Private Sub Test_numStrNotStartByZero()
    Dim result As String
    result = UtilsRandom.numStrNotStartByZero(10)
    Debug.Assert Len(result) = 10
    Debug.Assert Mid(result, 1, 1) <> 0
    
    
    Dim i As Integer
    Dim ascCode As Integer
    For i = 1 To 10
        ascCode = Asc(Mid(result, i, 1))
        Debug.Assert ascCode >= 48
        Debug.Assert ascCode <= 57
    Next
End Sub

Private Sub Test_numInRange()
    Dim result As Integer
    result = UtilsRandom.numInRange(10, 20)
    Debug.Assert result >= 10
    Debug.Assert result <= 20
End Sub

Private Sub Test_lowerEnStr()
    Dim result As String
    result = UtilsRandom.lowerEnStr(10)
    
    Debug.Assert Len(result) = 10
    Dim i As Integer
    Dim ascCode As Integer
    For i = 1 To 10
        ascCode = Asc(Mid(result, i, 1))
        Debug.Assert ascCode >= 97
        Debug.Assert ascCode <= 122
    Next
End Sub

Private Sub Test_upperEnStr()
    Dim result As String
    result = UtilsRandom.upperEnStr(10)
    
    Debug.Assert Len(result) = 10
    Dim i As Integer
    Dim ascCode As Integer
    For i = 1 To 10
        ascCode = Asc(Mid(result, i, 1))
        Debug.Assert ascCode >= 65
        Debug.Assert ascCode <= 90
    Next
End Sub

Private Sub Test_enStr()
    Dim result As String
    result = UtilsRandom.enStr(10)
    
    Debug.Assert Len(result) = 10
    Dim i As Integer
    Dim ascCode As Integer
    For i = 1 To 10
        ascCode = Asc(Mid(result, i, 1))
        Debug.Assert (ascCode >= 65 And ascCode <= 90) Or (ascCode >= 97 And ascCode <= 122)
    Next
End Sub

Private Sub Test_yyyyMMddInYearRange()
    Dim result As String
    result = UtilsRandom.yyyyMMddInYearRange(2019, 2021)
    
    Dim num As Integer
    num = CInt(Mid(result, 1, 4))
    Debug.Assert num >= 2019 And num <= 2021
    
    num = CInt(Mid(result, 5, 2))
    Debug.Assert num >= 1 And num <= 12
    
    num = CInt(Mid(result, 7, 8))
    Debug.Assert num >= 1 And num <= 31
End Sub

Private Sub timestampTest()
    Dim result As String
    result = UtilsRandom.timestamp(2019, 2021)
    
    Dim num As Integer
    num = CInt(Mid(result, 1, 4))
    Debug.Assert num >= 2019 And num <= 2021
    
    Debug.Assert Mid(result, 5, 1) = "-"
    
    num = CInt(Mid(result, 6, 2))
    Debug.Assert num >= 1 And num <= 12
    
    Debug.Assert Mid(result, 8, 1) = "-"
    
    num = CInt(Mid(result, 9, 2))
    Debug.Assert num >= 1 And num <= 31
    
    Debug.Assert Mid(result, 11, 1) = " "
    
    num = CInt(Mid(result, 12, 2))
    Debug.Assert num >= 0 And num <= 23
    
    Debug.Assert Mid(result, 14, 1) = ":"
    
    num = CInt(Mid(result, 15, 2))
    Debug.Assert num >= 0 And num <= 59
    
    Debug.Assert Mid(result, 17, 1) = ":"
    
    num = CInt(Mid(result, 18, 2))
    Debug.Assert num >= 0 And num <= 59
    
    Debug.Assert Mid(result, 20, 1) = "."
    
    num = CInt(Mid(result, 21, 3))
    Debug.Assert num >= 0 And num <= 999
End Sub